export function getSystemInfo() {
    uni.getSystemInfo({
      success(res) {
        console.log(res);
        uni.setStorageSync('os', res.platform);
      }
    })
  }
  // 一些工具方法


// 判断 请求结果 是否有数据判断
/**
 *  @return {Object}
 * */
export function judgeEmptyState(array, page, limit = 10) {
	if (!array || !array.length) {
		return {
			noData: !page || page <= 1 ? true : false,
			noMore: true
		}
	} else {
		return {
			noData: false,
			noMore: array.length < limit ? true : false
		}
	}
}

// 类型判断 ， @return  小写
export function judgeType(o) {
	// if (o instanceof Element) {
	// 	return 'element';
	// }
	let s = Object.prototype.toString.call(o)
	return s.match(/\[object (.*?)\]/)[1].toLowerCase()
}


export function generateUUID() {
    var d = new Date().getTime()
    var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = (d + Math.random()*16)%16 | 0
        d = Math.floor(d/16)
        return (c=='x' ? r : (r&0x3|0x8)).toString(16)
    })
    return uuid
}
export function throttle(fn, delay) {
	let previous = 0
	return function() {
	  const args = arguments
	  const now = new Date()
	  if (now - previous > delay) {
		fn.apply(this, args)
		previous = now
	  }
	}
  }
